<!-- 微博模版 -->
<div class="warp weibo_item mdui-shadow-2 mdui-m-b-2">
    <!-- 微博内容 -->
    <div class="mdui-row mdui-p-a-2">
        <!-- 头像 -->
        <div class="mdui-col-md-1">
            <img style="width:50px;height:50px;" src="{{$data['avatar'] or asset('/images/50x50.png')}}" alt="Image">
        </div>
        <!-- 内容 -->
        <div class="mdui-col-md-11 mdui-typo">
            <a href="{{url('/u',['user_id'=>$data['user_id']])}}"><strong>{{$data['nickname']}}</strong></a>
            <p class="mdui-typo-caption-opacity">{{$data['created_at']}}</p>
            <p>
                <span><a href="{{url('/topic/'.$data['topic_id'])}}">{{$data['topic']}}</a></span>
                <span>{{$data['content']}}</span>
            </p>
            <!-- 如果是转发的微博, 在内容区嵌套一个微博 div -->
            @if($data['is_forward'])
                <div class="warp mdui-shadow-2 mdui-m-b-2">
                    <!-- 微博主体 -->
                    <div class="mdui-row mdui-p-a-2">
                        <!-- 去掉原微博的头像 -->
                        <!-- 微博内容 -->
                        <div class="mdui-col-md-11 mdui-typo">
                            <a href="{{url('/u',['id'=>$data['is_forward']['user_id']])}}"><strong>{{$data['is_forward']['nickname']}}</strong></a>
                            <p class="mdui-typo-caption-opacity">{{$data['is_forward']['created_at']}}</p>

                            <p>
                                <span><a href="{{url('/topic/'.$data['is_forward']['topic_id'])}}">{{$data['is_forward']['topic']}}</a></span>
                                {{$data['is_forward']['content']}}
                            </p>
                        </div>
                    </div>
                    <!-- 转发微博的操作按钮改为小型按钮, 并右对齐 -->
                    <div class="weibo-btn-group-forward">
                        <!-- 转发按钮 -->
                        <a href="{{url('/weibo',['id'=>$data['is_forward']['id']])}}">
                            <button class="mdui-btn mdui-btn-dense mdui-ripple btn-forward">
                                <i class="mdui-icon material-icons">forward</i>
                                <span>{{$data['is_forward']['forward_num']}}</span>
                            </button>
                        </a>
                        <!-- 评论按钮 -->
                        <a href="{{url('/weibo',['id'=>$data['is_forward']['id']])}}">
                            <button class="mdui-btn mdui-btn-dense mdui-ripple btn-comment">
                                <i class="mdui-icon material-icons">comment</i>
                                <span>{{$data['is_forward']['comment_num']}}</span>
                            </button>
                        </a>
                        {{--<!-- 点赞按钮 -->
                        <button class="mdui-btn mdui-btn-dense mdui-ripple">
                            <i class="mdui-icon material-icons">thumb_up</i>
                            赞
                        </button>--}}
                    </div>
                </div>
            @endif
        </div>
    </div>
    <!-- 操作按钮 -->
    <div class="weibo-btn-group" weibo_id="{{$data['id']}}">
        <!-- 收藏按钮 -->
        @if(isset($data['favorites']) && in_array($data['id'],explode(',',$data['favorites'])))
            {{--当前微博已收藏--}}
            <button do="cancel"
                    class="btn-favorite mdui-col mdui-btn mdui-ripple mdui-text-color-orange">
                <i class="mdui-icon material-icons">star</i>
                <span>已收藏</span>
            </button>
        @else
            {{--当前微博未收藏--}}
            <button do="favorite" class="btn-favorite mdui-col mdui-btn mdui-ripple">
                <i class="mdui-icon material-icons">star</i>
                <span>收藏</span>
            </button>
        @endif

    <!-- 转发面板按钮 -->
        <button class="btn-panel-forward mdui-col mdui-btn mdui-ripple ">
            <i class="mdui-icon material-icons">forward</i>
            <span>{{ $data['forward_num']}}</span>
        </button>
        <!-- 评论面板按钮 -->
        <button class="btn-panel-comment mdui-col mdui-btn mdui-ripple">
            <i class="mdui-icon material-icons">comment</i>
            <span>{{ $data['comment_num']}}</span>
        </button>
        <!-- 点赞按钮 -->
        @if(isset($data['likes']) && in_array($data['id'],explode(',',$data['likes'])))
            {{--当前微博已点赞--}}
            <button do="cancel"
                    class="btn-like mdui-col mdui-btn mdui-ripple mdui-text-color-orange">
                <i class="mdui-icon material-icons">thumb_up</i>
                <span>{{ $data['like_num']}}</span>
            </button>
        @else
            {{--当前微博未点赞--}}
            <button do="like" class="btn-like mdui-col mdui-btn mdui-ripple">
                <i class="mdui-icon material-icons">thumb_up</i>
                <span>{{$data['like_num']}}</span>
            </button>
        @endif
    </div>
    <!-- 转发面板 -->
    <div class="panel-forward mdui-p-x-2 mdui-m-b-1 mdui-hidden">
        <!-- 转发操作区 -->
        <form action="{{url('/weibo/store')}}" method="POST" class="form-forward mdui-p-x-2 mdui-p-y-1"
              role="form">
        {{csrf_field()}}
        <!-- 微博id -->
            <input type="hidden" name="weibo_id" value="{{$data['id']}}">
            <!-- 微博用户id -->
            <input type="hidden" name="user_id" value="{{$data['user_id']}}">
            <!-- 转发输入框 -->
            <div class="mdui-textfield">
                <textarea class="mdui-textfield-input" name="forward_content"
                          placeholder="转发微博"
                          autofocus="autofocus" maxlength="140"></textarea>
            </div>
            <!-- 表情按钮 -->
            <div class="mdui-chip mdui-m-r-1">
                <span class="mdui-chip-icon mdui-color-yellow">
                   <i class="mdui-icon material-icons">&#xe420;</i>
                </span>
                <span class="mdui-chip-title">表情</span>
            </div>
            <!-- 转发时评论 -->
        {{--<label class="mdui-checkbox">
            <input type="checkbox" name="forward_with_comment"/>
            <i class="mdui-checkbox-icon"></i>
            同时评论给 xxx
        </label>--}}
        <!-- 提交转发按钮 -->
            <button type="submit" class="btn-forward mdui-btn mdui-btn-raised mdui-btn-dense mdui-ripple mdui-color-theme-accent mdui-float-right">转发</button>
        </form>
        <!-- 评论内容区 -->
        <div class="forward-list mdui-typo">
            <!-- ajax循环区 -->
        </div>
    </div>
    <!-- 评论面板 -->
    <div class="panel-comment mdui-p-x-2 mdui-m-b-1 mdui-hidden">
        <!-- 评论操作区 -->
        <form action="" method="POST" class="form-comment mdui-p-x-2 mdui-p-y-1"
              role="form">
        {{csrf_field()}}
        <!-- 当前微博id -->
            <input type="hidden" name="weibo_id" value="{{$data['id']}}">
            <!-- 当前登录用户id-->
            <input type="hidden" name="user_id" value="{{Session::get('user.id')}}">
            <!-- 评论输入框 -->
            <div class="mdui-textfield">
                <textarea class="mdui-textfield-input" name="comment_content"
                          placeholder="评论"
                          autofocus="autofocus" maxlength="140"></textarea>
            </div>
            <!-- 表情按钮 -->
            <div class="mdui-chip mdui-m-r-1">
                <span class="mdui-chip-icon mdui-color-yellow">
                   <i class="mdui-icon material-icons">&#xe420;</i>
                </span>
                <span class="mdui-chip-title">表情</span>
            </div>
            <!-- 评论时转发 -->
        {{--<label class="mdui-checkbox">
            <input type="checkbox"/>
            <i class="mdui-checkbox-icon"></i>
            同时转发到我的微博
        </label>--}}
        <!-- 提交评论按钮 -->
            <a class="btn-comment mdui-btn mdui-btn-raised mdui-btn-dense mdui-ripple mdui-color-theme-accent mdui-float-right">评论</a>
        </form>
        <!-- 评论内容区 -->
        <div class="comment-list mdui-typo">
            <!-- ajax循环区 -->
        </div>
    </div>
</div>